package com.tm.fiverole.mapper;

import com.tm.fiverole.entity.RoleEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author wangSang
 * @create 2022-08-18 19:02
 */
@Mapper
public interface RoleMapper {


    List<RoleEntity> queryRoleId(@Param("id") Integer id);

    void addRole(RoleEntity roleEntity);

    void updateRole(RoleEntity roleEntity);

    void deleteRole(Integer id);

    @Select("SELECT msr.`name` from mall_sys_role msr  LEFT JOIN  mall_sys_user_role_relation msurr " +
            " on msr.id=msurr.role_id where msurr.user_id=#{id} ")
    List<String> queryRoleNameListByUserId(@Param("id") Long id);
}
